home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Aminet 41
/
Aminet 41 (2001)(Schatztruhe)[!][Feb 2001].iso
/
Aminet
/
comm
/
tcp
/
rxsocket.lha
/
rxsocket
/
examples
/
ioctl.rexx
< prev
next >
Wrap
OS/2 REXX Batch file
|
2000-11-28
|
2KB
|
79 lines
/*
HOW TO USE IoctlSocket()
*/
l="rexxsupport.library";if ~show("L",l) then;if ~addlib(l,0,-30) then do;say "can't find" l;exit;end
l="rmh.library";if ~show("L",l) then;if ~addlib(l,0,-30) then do;say "can't find" l;exit;end
l="rxsocket.library";if ~show("L",l) then;if ~addlib(l,0,-30) then do;say "can't find" l;exit;end
parse arg dev
s=socket("INET","DGRAM")
if s<0 then do
call err "socket"
exit
end
/* SET the socket as async */
res = IoctlSocket(s,"FIOASYNC",1)
if res<0 then call error "FIOASYNC"
else say "socket is FIOASYNC"
/* SET the socket as non blocking */
res = IoctlSocket(s,"FIONBIO",1)
if res<0 then call error "FIONBIO"
else say "socket is FIONBIO"
/* CHECK if at OOB */
res = IoctlSocket(s,"SIOCATMARK","A")
if res<0 then call error "SIOCATMARK"
else say "SIOCATMARK:" a
/* GET number of bytes ready to be read */
res = IoctlSocket(s,"FIONREAD","A")
if res<0 then call error "FIONREAD"
else say "FIONREAD:" a
/* GET vaious interface attributes*/
res = IoctlSocket(s,"SIOCGIFADDR",dev,"A")
if res<0 then call error "SIOCGIFADDR"
else say "SIOCGIFADDR:" a
res = IoctlSocket(s,"SIOCGIFDSTADDR",dev,"A")
if res<0 then call error "SIOCGIFDSTADDR"
else say "SIOCGIFDSTADDR:" a
res = IoctlSocket(s,"SIOCGIFBRDADDR",dev,"A")
if res<0 then call error "SIOCGIFBRDADDR"
else say "SIOCGIFBRDADDR:" a
res = IoctlSocket(s,"SIOCGIFNETMASK",dev,"A")
if res<0 then call error "SIOCGIFNETMASK"
else say "SIOCGIFNETMASK:" a
res = IoctlSocket(s,"SIOCGIFFLAGS",dev,"A")
if res<0 then call error "SIOCGIFFLAGS"
else say "SIOCGIFFLAGS:" a
res = IoctlSocket(s,"SIOCGIFMETRIC",dev,"A")
if res<0 then call error "SIOCGIFMETRIC"
else say "SIOCGIFMETRIC:" a
res = IoctlSocket(s,"SIOCGIFMTU",dev,"A")
if res<0 then call error "SIOCGIFMTU"
else say "SIOCGIFMTU:" a
res = IoctlSocket(s,"SIOCGIFPHYS",dev,"A")
if res<0 then call error "SIOCGIFPHYS"
else say "SIOCGIFPHYS:" a
exit
error:
parse arg attr
e=errno()
if IsLibOn("TTCP") then say "error on" attr":" e
else say "error on" attr":" errorstring(e)
return